package com.kgc.cn.service;

import com.kgc.cn.dto.ZipkinSpans;
import com.kgc.cn.dto.ZipkinSpansExample;
import com.kgc.cn.mapper.ZipkinSpansMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jialin
 * @create 2020-10-24
 */
@RestController
public class ZipkinService {

    @Autowired
    private ZipkinSpansMapper zipkinSpansMapper;

    @GetMapping(value = "/getName")
    public ZipkinSpans getName(@RequestParam(value = "id") Long id){
        ZipkinSpansExample zipkinSpansExample = new ZipkinSpansExample();
        zipkinSpansExample.createCriteria().andIdEqualTo(id);
        return zipkinSpansMapper.selectByExample(zipkinSpansExample).get(0);
    }

    @GetMapping(value = "/getNo")
    public ZipkinSpans getNo(@RequestParam(value = "id") Long id){
        ZipkinSpansExample zipkinSpansExample = new ZipkinSpansExample();
        zipkinSpansExample.createCriteria().andIdEqualTo(id);
        return zipkinSpansMapper.selectByExample(zipkinSpansExample).get(0);
    }

}
